77 INPUT ;"",AX: IF AX>1 THEN BEEP: PRINT "The number of positive cases per group should be 0 or 1.": GOTO 62 ELSE PRINT TAB(56);
80 INPUT "",BX: IF BX>AM THEN BEEP: PRINT "The number of positive controls per group should be";AM;"or less.": GOTO 62
82 CX=AX+BX: HX=HX+CX: HX2=HX2+CX*CX: XBT=XBT+BX
85 NEXT Z: PRINT STRING$(66,"-"): PRINT: PRINT
90 GOTO 180
100 OPEN FILE$ FOR INPUT AS #1: INPUT #1, A,C
105 DIM D(A,C),CS(A,C),N$(A),X(A),X2(A),T(A),SD(A),MD(A),NS(A)
110 FOR T=1 TO A: INPUT #1, T(T): NEXT
115 FOR T=1 TO A: FOR Z=1 TO C: INPUT #1, D(T,Z): NEXT: NEXT
120 FOR T=1 TO A: FOR Z=1 TO T(T): INPUT #1, CS(T,Z): NEXT: NEXT
125 FOR T=1 TO A: INPUT #1, N$(T),X(T),X2(T),MD(T),SD(T): NEXT: CLOSE #1
130 PRINT: PRINT: PRINT TAB(11);: INPUT "How many CONTROLS are there for each CASE? ",AM: PRINT
135 PRINT TAB(10);: INPUT;"What is the SAMPLE NUMBER of the CASE group? ",NS(1): PRINT " `";N$(NS(1));"'"
140 PRINT TAB(9);"What are the";AM;"SAMPLE NUMBERS of the CONTROL groups?";
145 FOR Z=2 TO AM+1: PRINT TAB(64);:INPUT;"",NS(Z): PRINT " `";N$(NS(Z));"'";: NEXT Z
150 FOR Z=2 TO AM+1: IF T(NS(1))<>T(NS(Z)) THEN BEEP: PRINT "These samples do not all have the same number of elements----": PRINT TAB(25);"a paired Mantel-Haenszel test cannot be performed.": GOTO 290
155 NEXT: XBT=0: HX=0: HX2=0
160 FOR Z=1 TO T(NS(1)): XA=VAL(D(NS(1),Z)): XB=0: IF ABS(XA-0.5)>0.51 THEN 320
165 FOR T=2 TO AM+1: QX=VAL(D(NS(T),Z)): XB=XB+QX: IF ABS(QX-0.5)>0.51 THEN 320
270 PLAY "O3 MB MS T120 L16 D-FA- O4 L8 D- P8 O3 L3 D-": PRINT TAB(10);
280 COLOR 0,7: PRINT TAB(28);"p = ";: IF P<=0 THEN PRINT "< 10 (-8)"; ELSE PRINT P;
290 PRINT TAB(60): COLOR 7,0: PRINT: PRINT: PRINT: PRINT TAB(3);
300 INPUT "Do you want to calculate another Mantel-Haenszel test? (Y or N) ",A$:IF A$="y" OR A$="Y" THEN 10
310 END
320 BEEP: PRINT: PRINT: PRINT "An error in data entry was detected:": PRINT "All records should contain a "1" if factor is present, a "0" if it is absent.": PRINT: GOTO 290
330 BEEP: PRINT: IF ERL=100 AND ERR=53 THEN PRINT TAB(13); "I cannot find a file by that name on drive "; ELSE 360
340 IF MID$(FILE$,2,1)=":" THEN DR$=LEFT$(FILE$,2) ELSE DR$="A:"